﻿using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;

namespace CodeAngel.UI
{
    /// <summary>
    ///
    /// </summary>
    [ContentProperty("Content")]
    public class HorizontalLabeledControl : Control
    {
        static HorizontalLabeledControl()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalLabeledControl), new FrameworkPropertyMetadata(typeof(HorizontalLabeledControl)));
        }

        #region Label

        /// <summary>
        /// Gets or sets the Label.
        /// </summary>
        public string Label
        {
            get { return (string)GetValue(LabelProperty); }
            set { SetValue(LabelProperty, value); }
        }

        /// <summary>
        /// Using a DependencyProperty as the backing store for Label.
        /// </summary>
        public static readonly DependencyProperty LabelProperty =
            DependencyProperty.Register("Label", typeof(string), typeof(HorizontalLabeledControl), new UIPropertyMetadata("label"));

        #endregion

        #region LabelWidth

        /// <summary>
        /// Gets or sets the LabelWidth.
        /// </summary>
        public double LabelWidth
        {
            get { return (double)GetValue(LabelWidthProperty); }
            set { SetValue(LabelWidthProperty, value); }
        }

        /// <summary>
        /// Using a DependencyProperty as the backing store for LabelWidth.
        /// </summary>
        public static readonly DependencyProperty LabelWidthProperty =
            DependencyProperty.Register("LabelWidth", typeof(double), typeof(HorizontalLabeledControl), new UIPropertyMetadata(double.NaN));

        #endregion
        
        #region Content

        /// <summary>
        /// Gets or sets the Content.
        /// </summary>
        public UIElement Content
        {
            get { return (UIElement)GetValue(ContentProperty); }
            set { SetValue(ContentProperty, value); }
        }

        /// <summary>
        /// Using a DependencyProperty as the backing store for Content.
        /// </summary>
        public static readonly DependencyProperty ContentProperty =
            DependencyProperty.Register("Content", typeof(UIElement), typeof(HorizontalLabeledControl), new UIPropertyMetadata(null));

        #endregion

    }
}
